<?php

namespace app\index\controller;

use app\common\controller\Frontend;
use think\Db;
class Index extends Frontend
{

    protected $noNeedLogin = '*';
    protected $noNeedRight = '*';
    protected $layout = '';

    public function index()
    {	
    	$param = $this->request->param();
    	if($this->request->isPost()){
    		$data['tel'] = $param['tel'];
    		$data['shopname'] = $param['shopname'];
    		$data['xihuan'] = $param['xihuan'];
    		$data['manyi'] = $param['manyi'];
    		// $data['name'] = $param['name'];
    		$data['jianyi'] = $param['jianyi'];
    		$data['ip'] = $this->request->ip();
    		// $data['content'] = $param['content'];
    		// $data['ps'] = $param['ps'];

    		$data['createtime'] = time();

    		$charu= Db::name('gbook2')->insert($data);
			if($charu){
				return 'ok';
			}
    		// $res = Db::name('gbook2')->where('id','>',0)->select();
    		// dump($res);
    	}
    	// dump();
        return $this->view->fetch();
    }

    public function news()
    {
        $newslist = [];
        return jsonp(['newslist' => $newslist, 'new' => count($newslist), 'url' => 'https://www.fastadmin.net?ref=news']);
    }
    public function yydd()
    {
    	$param = $this->request->param();
    	if($this->request->isPost()){
    		$data['tel'] = $param['tel'];
    		$data['shopname'] = $param['shopname'];
    		$data['sex'] = $param['sex'];
    		$data['address'] = $param['address'];
    		$data['name'] = $param['name'];
    		$data['shoptime'] = strtotime($param['shoptime']); 
    		$data['ip'] = $this->request->ip();
    		// $data['content'] = $param['content'];
    		// $data['ps'] = $param['ps'];

    		$data['createtime'] = time();

    		$charu= Db::name('yuyue')->insert($data);
			if($charu){
				return 'ok';
			}
    		// $res = Db::name('gbook2')->where('id','>',0)->select();
    		// dump($res);
    	}
    	// dump();
        return $this->view->fetch();
    }

}
